<html>
 <head>
  <title>YouTube Duplicate Video Finder - Comparing Page</title>
  <style type="text/css">
  	fieldset { font-family: Arial; margin: 25 auto; text-align: center; width: 550px; border-style: solid; border-color: black; padding: 10px }
	legend { font-size: 25px; font-weight: bold; font-variant: small-caps }
	.buttons { border-style: solid; border-color: #666666; background-color: #EEEEEE }
	.texts { border-style: solid; border-color: #666666; background-color: #EEEEEE; padding-left: 2px; padding-right: 2px }
	#tolerance { border-style: solid; border-color: #666666; background-color: #EEEEEE; padding-left: 2px; padding-right: 2px }
	#errorDiv { border-style: solid; border-color: red; margin-left: 5px; margin-right: 5px; margin-top: 15px }
  	#tube { color: white; background-color: red; padding-left: 3px; padding-right: 3px }
  	.defaultDiv { margin-bottom: 5px; margin-top: 5px }
  </style>
  <script src="../../prototypeServer/" type="text/javascript"></script>
  <script language="javascript" type="text/javascript">
    function getCompareCount()
	{
		new Ajax.PeriodicalUpdater('compareText', '../functionServer', {
		  method: 'get',
		  frequency: 3,
		  onSuccess: videoCompared,
		  parameters: { 'function': 'getCompareCount' }
		});
    }

    function getResultsUrl()
	{
		new Ajax.Request('../functionServer',{
	      method: 'get',
	      parameters: { 'function': 'getResultsUrl' },
	      onComplete: sessionEnded
	    });
    }

	function videoCompared(response)
	{
		if (response.responseText == 'All videos compared.')
		{
			getResultsUrl();
		}
	}

	function sessionEnded(response)
	{
		hideCompareText();
		hideButton();
		$('sessionEndedText').update('Session ended. Results saved to ' + response.responseText);
	}

	function hideCompareText()
	{
		$('compareText').hide();
	}

	function hideButton()
	{
		$('continueButton').hide();
	}
  </script>
 </head>
 <body onLoad='getCompareCount();'>
  <fieldset>
   <legend>You<span id="tube">Tube</span> Duplicate Video Finder</legend>
 	<div id="sessionEndedText" class="defaultDiv">
	</div>
	<div id="compareText" class="defaultDiv">
	</div>
	<div id="continueButton" class="defaultDiv">
	  <input type="button" name="mainContinueButton" id="mainContinueButton" class="buttons" value="Stop & Show Results" onClick='getResultsUrl();'>
	</div>
  </fieldset>
 </body>
</html>